package org.squabble.web.article;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.squabble.domain.Article;
import org.squabble.service.ArticleService;

@Controller
public class FrontPageController {
	
	@Autowired
	ArticleService articleService;
	
	@RequestMapping("/")
	public String execute(ModelMap modelMap) {
		List<Article> articles = articleService.getIndexArticles();
		modelMap.addAttribute("articles", articles);
		return "index";
	}
	
}
